package com.sikao.app.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.sikao.app.R;
import com.sikao.app.bean.MallGoodsDetailBean;
import com.sikao.app.net.HttpApi;

import java.util.List;

/**
 * Created by y50 on 2016/5/23.
 */
public class InspectionReportAdapter extends BaseAdapter {

	private Context context;
	private List<MallGoodsDetailBean.ResBean.CheckReportInfoBean> check_report;//质检报告
	public InspectionReportAdapter(Context context,List<MallGoodsDetailBean.ResBean.CheckReportInfoBean> check_report){
		this.context = context;
		this.check_report=check_report;
	}
	@Override
	public int getCount() {
		return check_report.size();
	}

	@Override
	public Object getItem(int position) {
		return check_report.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if(convertView==null) {
			convertView = View.inflate(context, R.layout.pictures_list_item, null);
			convertView.setTag(new ViewHolder(convertView));
		}
		initializeViews((MallGoodsDetailBean.ResBean.CheckReportInfoBean)getItem(position), (ViewHolder) convertView.getTag());
		return convertView;
	}

	private void initializeViews(MallGoodsDetailBean.ResBean.CheckReportInfoBean checkReportInfoBean, ViewHolder viewHolder) {

		ImageLoader.getInstance().displayImage(HttpApi.BANNERUTL+checkReportInfoBean.getUrl(),viewHolder.iv);//HttpApi.BANNERUTL+

	}
	public class ViewHolder {
		public final ImageView iv;
		public final View root;

		public ViewHolder(View root) {
			iv = (ImageView) root.findViewById(R.id.iv);
			this.root = root;
		}
	}
}
